<!-- head -->
{include file='public/head' /}
<!-- head -->
<!-- left -->
{include file='public/left' /}
<!-- left -->

<div class="content-wrapper">
    <section class="content-header">
        <h1>
            管理员
            <small>全部管理员</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 权限管理</a></li>
            <li class="active">管理员</li>
        </ol>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title" style="font-size: 14px;">共计{$AdminList->total()}条记录</h3>
                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-sm bg-olive" data-url="{:url('admin/Admin/AddAdmin','','')}" onclick="ShowMessage(this)"><span class="fa fa-plus"></span> 添加</button>
                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                            </button>
                            <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                        </div>
                    </div>
                    <div class="box-body">
                        <div class="table-responsive">
                            <table class="table table-bordered table-striped">
                                <form id='iform' action="{:url('admin/AdminList')}" method="post">
                                    <div class="input-group">
                                        <select class="form-control select" style="width: 100%;" name="status">
                                            <option value="1" {if condition="$status eq 1"}selected {/if}>启用</option>
                                            <option value="2" {if condition="$status eq 2"}selected {/if}>禁用</option>
                                        </select>
                                        <span class="input-group-btn">
                                            <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
                                            </button>
                                        </span>
                                    </div>
                                </form>
                                <thead>
                                    <tr>
                                        <th>编号</th>
                                        <th>账号</th>
                                        <th>名称</th>
                                        <th>头像</th>
                                        <th>角色</th>
                                        <th>最后登录时间</th>
                                        <th>最后登录IP</th>
                                        <th>状态</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {volist name='AdminList' id='admin'}
                                    <tr>
                                        <td>{$admin.id}</td>
                                        <td>{$admin.admin_name}</td>
                                        <td><span style="color: #00a65a">{$admin.admin_note}</span></td>
                                        <td><img src="{:config('adminconfig.ImgPath')}/{$admin.photo}" width="60px;"></td>
                                        <td>
                                            {if condition="$admin.type eq 1"}后台管理员
                                            {else/}技术部门
                                            {/if}
                                        </td>
                                        <td>{$admin.last_time|date='Y-m-d H:i:s',###}</td>
                                        <td>{$admin.login_ip}</td>
                                        <td>
                                            {if condition="$admin.status eq 1"}<span class="fa fa-toggle-on"></span>
                                            {else/}<span class="fa fa-toggle-off"></span>
                                            {/if}
                                        </td>
                                        <td style="width: 200px; text-align:right;">
                                            {if condition="$admin.status eq 1"}
                                            <button type="button" class="btn btn-sm bg-olive" data-url="{:url('admin/Admin/AdminStatus',['id'=>$admin.id,'status'=>2],'')}" onclick="ShowMessage(this)">锁定 </button>
                                            {else/}
                                            <button type="button" class="btn btn-sm bg-olive" data-url="{:url('admin/Admin/AdminStatus',['id'=>$admin.id,'status'=>1],'')}" onclick="ShowMessage(this)">启用 </button>
                                            {/if}
                                            <button type="button" class="btn btn-sm bg-olive" data-url="{:url('admin/Admin/AdminEdit',['id'=>$admin.id],'')}" onclick="ShowMessage(this)">修改 </button>
                                            <button type="button" class="btn btn-sm bg-orange" data-url="{:url('admin/Admin/role',['id'=>$admin.id],'')}" onclick="ShowMessage(this)">权限管理 </button>
                                        </td>
                                    </tr>
                                    {/volist}
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="box-footer clearfix" style="text-align: center">
                        {$AdminList->render()}
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<script type="text/javascript">
    var dataId = 0;

    function ShowMessage(obj) {
        var url = $(obj).data('url');
        window.location.href = url;
    }

    function del(id) {
        dataId = id;
        showConfirm('删除', '确认删除？', delManager);
    }

    function delManager() {
        $.ajax({
            url: "{:url('admin/Webcast/DelWebcast','','')}",
            type: 'GET',
            data: {
                'id': dataId,
            },
            dataType: 'JSON',
            success: function (data) {
                showAlert('提示', data.msg, null);
                if (data.code == 0) {

                }
            }
        });
    }
</script>
<!-- foot -->
{include file='public/foot' /}
<!-- foot -->